import request from "@/utils/request";
//单个文件上传
export function fileUpload(file) {
  return request({
    url: "/file/upload",
    method: "post",
    data: file,
  });
}
//多个文件上传
export function filesUpload(files) {
  return request({
    url: "/file/uploadFiles",
    method: "post",
    data: files,
  });
}
//文件临时访问httpurl
export function fileHttpUrl(files) {
  return request({
    url: "/file/fileHttpUrl",
    method: "post",
    data: files,
  });
}
//文件下载
export function fileDown(name, path) {
  return request({
    url: `/file/download?file_name=${encodeURIComponent(name)}&file_path=${path}`,
    method: "post",
  });
}
//文件删除
export function fileDel(filePath) {
  return request({
    url: "/file/delete?file_path=" + filePath,
    method: "delete",
  });
}
//生成合同
export function contactDown(applyId) {
  return request({
    url: "/file/creatLoanContract/" + applyId,
    method: "post",
  });
}

//文件下载
export function getFileDown(name, path) {
  return request({
    url: `/file/download?file_name=${encodeURIComponent(name)}&file_path=${path}`,
    method: "get",
  });
}
